import React, { useEffect } from 'react';
import logo from './logo.svg';
import './App.css';
import A from './components/A';
import { login } from './api/users';

// JSX.Element 组件的返回值类型
function App (): JSX.Element {
  useEffect(() => {
    login({ username: '123', password: '123' }).then(res => {
      console.log(res.data.token);
    }).catch(err => {
      console.log(err);
    });
  }, []);
  return (
    <div className="App">
      <A password="123456" username='123' />
      <header className="App-header">
        <img src={logo} className="App-logo" alt="logo" />
        <p>
          Edit <code>src/App.tsx</code> and save to reload.
        </p>
        <a
          className="App-link"
          href="https://reactjs.org"
          target="_blank"
          rel="noopener noreferrer"
        >
          Learn React
        </a>
      </header>
    </div>
  );
}

export default App;
